package com.platform.controller;

import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.platform.utils.HttpContextUtils;

public abstract class BaseController {
    protected Logger logger = LoggerFactory.getLogger(getClass());

    public void setErrMessage(Map<String,Object> params,String errMessage, Exception e) {
		String errMessage_more = e.getMessage();
		errMessage_more += "<br> 错误来源:";
		StringWriter sw = new StringWriter();
		PrintWriter pw = new PrintWriter(sw);
		try {
			e.printStackTrace(pw);
			errMessage_more += sw.toString();
			sw.close();
			pw.close();
		} catch (Exception ee) {
		}
		params.put("errMessage", errMessage);
		params.put("errMessage_more", errMessage_more);
		logger.error(e.getMessage(),e);
	}	

}
